<?php
//提取数据模式
//$db = new PDO('mysql:host=localhost;dbname=db3','root','12qwas');
//$ps=$db->query('select * from students limit 1');
//$rs=$ps->fetchAll(PDO::FETCH_ASSOC);
//print_r($rs);


//利用PDO::query查询
//$db = new PDO('mysql:host=localhost;dbname=db3','root','12qwas');
//$ps = $db->query('select * from students limit 1',PDO::FETCH_ASSOC);
//print_r($ps->fetch());


//利用语句对象进行查询
$db = new PDO('mysql:host=localhost;dbname=db3','root','12qwas');
$ps=$db->prepare('select * from students where xh=?');
$ps->setFetchMode(PDO::FETCH_ASSOC);
$ps->execute(['233110203']);
print_r($ps->fetch());





